#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    bool containsNearbyDuplicate(vector<int>& nums, int k)
    {
        int len = nums.size();
        for (int i = 0; i < len; i++)
        {
            for (int j = 1; j <= k && (i + j) < len; j++)
            {
                if (nums[i] == nums[i + j])
                    return true;
            }
        }
        return false;
    }
};
int main()
{
    Solution s;
    vector<int>v{ 1,2,3,1,2,3 };
    s.containsNearbyDuplicate(v, 2);
    return 0;
}